<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/10/21
 * Time: 16:27
 */

namespace app\adminapiv3\controller;

use  app\adminapiv3\service;
//登录
class Login extends Base
{
    /**
     * @name 登录
     * @author wx
     * @date 2019/10/21 16:28
     */
    public function login()
    {
        //接收参数
        $name = $this->filterInput('name*','post');
        $password = $this->filterInput('password*','post');
        $captchaCode = $this->filterInput('captcha*','post');
        $captchaCode = strtolower($captchaCode);//不区分大小写


        $LoginServer = new service\Login($name);

        $return_data = $LoginServer->login($password, $captchaCode);

        $this->jsonOutPut($return_data);
    }

    /**
     * @name 验证码
     * @author wx
     * @date 2019/10/21 16:29
     */
    public function code()
    {
        $codeServer = new service\ServerRandCode();
        $code = $this->toDo([$codeServer,'createCaptcha']);

        $data['captcha_code'] = $code;
        $this->jsonOutPut($data);
    }



}